package com.ktg.mes.chanjet.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ktg.common.core.domain.treeSelectInterface;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Data
@TableName("tp_item_type")
@ApiModel(value=" TpItemType 对象", description="T+ - 存货分类")
public class TpItemType implements treeSelectInterface {

    @TableId(value = "id")
    private Long id;

    @TableField(value ="item_type_code")
    private String itemTypeCode;

    @TableField(value = "item_type_name")
    private  String itemTypeName;

    @TableField(value = "parent_type_id")
    private Long parentTypeId;

    @TableField(value = "parent_type_code")
    private String parentTypeCode;

    @TableField(value = "item_or_product")
    private String itemOrProduct;

    @TableField(value = "order_num")
    private int orderNum;

    @TableField(value = "enable_flag")
    private String enableFlag;

    @TableField(value = "remark")
    private String remark;

    @TableField(value = "ancestors")
    private String ancestors;

    @TableField(value = "create_by")
    private String createBy;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField(value = "create_time")
    private Date createTime;

    @TableField(value = "update_by")
    private String updateBy;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField(value = "update_time",update = "now()")
    private Date updateTime;


    @TableField(value = "mes_type")
    private String mesType;


    @TableField(exist = false)
    private List<TpItemType> children = new ArrayList<TpItemType>();


    @Override
    public Long getTreeSelectTypeId() {
        return getId();
    }

    @Override
    public String getTreeSelectTypeName() {
        return getItemTypeName();
    }

    @Override
    public List getTreeSelectChildren() {
        return getChildren();
    }
}
